package hms.inventory;
/**
 * Size is an inventory size.
 * 
 * @author Akilah McIntyre
 */
public class Size {
	/**
	 * unique identifier of an inventory size
	 */
	public int size_id = -1;
	/**
	 * name of an inventory size
	 */
	public String size_name = "";

	/**
	 * Constructs an inventory size from an unique identifier and a name.
	 * 
	 * @param sizeID
	 *            unique identifier of an inventory size
	 * @param sizeName
	 *            name of of an inventory size
	 * 
	 **/
	public Size(int sizeID, String sizeName) {
		this.size_id = sizeID;
		this.size_name = sizeName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + size_id;
		result = prime * result
				+ ((size_name == null) ? 0 : size_name.hashCode());
		return result;
	}

	/**
	 * Compares two sizes for equality. The result is true if and only if the
	 * argument is not null and if a Size object has the same unique identifier
	 * and name as this object.
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof Size)) {
			return false;
		}
		Size other = (Size) obj;
		if (size_id != other.size_id) {
			return false;
		}
		if (size_name == null) {
			if (other.size_name != null) {
				return false;
			}
		} else if (!size_name.equals(other.size_name)) {
			return false;
		}
		return true;
	}

	/**
	 * Returns a string representation of this Size, which is size_name
	 **/
	public String toString() {
		return size_name;
	}

}